The present invention relates to graphics generation and display systems and methods, and more particularly, to methods and systems of performing non-divisible memory operations for accessing a z-buffer during the generation and display of three-dimensional graphical images in a burst mode transfer data storage environment.
In many modern computers or computerized systems, a graphics display system provides a display device along with memory and a processor to display graphical images. The display device generally includes a pixel-oriented output device that displays a plurality of pixels, a pixel being the smallest addressable element in the output device. Examples of a pixel-oriented output devices include CRT monitors, LCD displays, and the like. The individual pixels on the output device are addressed using x and y coordinates, in the same manner as points on a graph are addressed.
The memory includes a frame buffer. The frame buffer stores a pixel number map corresponding to the graphical image displayed on the output device. The pixel number map is generally represented by a grid-like array of pixels where each pixel is assigned a color and a shade value. The processor computes and updates the pixel values in the frame buffer when a new graphical image is to be displayed. In processing a three-dimensional graphical object, the depth attribute of the object must be considered prior to the updating of any pixel values in the frame buffer. If the new object being processed is located behind and is partially obscured by the displayed object, only a visible portion of the new object should be displayed. On the other hand, if the new object is completely obscured by the displayed object, no updates to the frame buffer are necessary and the new object is not displayed.
Three-dimensional objects are often represented by a set of vertices defining polygon surfaces. Each vertex is defined by x, y, and z dimensions corresponding to the X, Y, and Z axes. The X and Y axes define a view plane and the Z axis represents a distance from the view plane. A z coordinate value, therefore, indicates the depth of an object at a pixel location defined by specific x and y coordinates.
Therefore, in a three-dimensional graphics display system, the memory also includes a z-buffer. The z-buffer stores the z-value of each pixel, and hence, the depth value of each pixel, and permits performance of depth analysis of a three-dimensional object. This process is often referred to as a “hidden surface removal process.” When a new object moves into a displayed portion of the view plane, a determination must be made as to whether the new object is visible and should be displayed, or whether the new object is hidden by objects already in the displayed portion of the view plane. The determination of whether the new object should be displayed is generally done on a pixel-by-pixel basis.
Thus, for each pixel, defined by x-y coordinates, the depth, or z-value, of the new object is compared to the depth, or z-value, of the currently displayed object. If the comparison indicates that the new pixel to be drawn is in front of the old pixel in the z-buffer (i.e., the new z-value is less than the old z-value), the old z-value is replaced with the new z-value, and red, blue, green and intensity values for the new pixel are written to the frame buffer for being displayed in the place of the old pixel. On the other hand, if the new pixel is located behind the old pixel, it will be hidden from view and need not be displayed. In this situation, the old z-value is kept in the z-buffer and the new z-value is discarded. The old pixel remains displayed and is not replaced by the new pixel.
The pixel-by-pixel analysis during the display or rendering of an object requires a z-buffer read for each pixel to compare the z-value of the old pixel with respect to the new pixel. Additionally, a conditional update of the z-buffer is required based on the comparison of the z-values. Because z-buffers are large and cannot be stored on-chip, thereby requiring external memory access, such z-comparisons and updates significantly slow down the rendering process. However, many advancements with memory technology to increase the speed of memory access, and thus the pixel-by-pixel analysis, have been achieved. In particular, one advancement to increase the speed of memory access that is often utilized is a burst mode transfer technique.
Burst mode transfer combines individual read requests and write requests to memory into aggregates, with each aggregate being formed of many individual read requests or write requests. Burst mode transfer sends these aggregates in bursts, such that an aggregate of individual read requests are transferred followed by an aggregate of individual write requests. Therefore, groups of read or write requests can be serviced at the same time instead of individually and thus be serviced quicker. The order of the individual read requests in relation to the individual write requests, however, is not necessarily maintained.
Thus, if the device is transmitting information sequentially loaded into an area in memory, the order in which the information is received may not be the order in which it was sequentially loaded into memory. In other words, z-buffering operations that perform the hidden surface removal process may not operate as intended. The z-buffering operations include numerous atomic operations. An atomic operation is a read-modify-write request performed in a non-divisible manner. As such, data at times needs to be fetched, modified and written back to the same memory location in the z-buffer in an ordered fashion to maintain memory coherency. However, during a burst mode transfer, memory coherency, i.e., the order in which data is stored in memory, can be disrupted.
For example, a first read-modify-write and a second read-modify-write request each directed to the same memory location in the z-buffer are received. Upon a burst mode transfer occurring, two read requests corresponding to the first and second read-modify-write requests are serviced prior to the two write requests. Therefore, the second read request in the first read-modify-write request is performed prior to the first write request in the read-modify-write request, and thereby disrupting the coherency of the data stored in the z-buffer. The lack of data coherency causes invalid data to be used. Since both read-modify-write requests are directed towards the same memory location, the second read request will read data that otherwise would have been modified by the first write in the first read-modify-write request if both read-modifiy-write requests were performed in atomic order.
The use of both burst mode transfer technology and atomic operations is therefore problematical. Burst mode transfer technology requires that at times information be transmitted in an order possibly different from that otherwise expected by the sender. The use of atomic operations, on the other hand, requires that received requests be in a predefined order with respect to the atomic operations. Accordingly, methods and systems which overcome the obstacles of using of both burst mode transfer technology and atomic operations are desirable.